﻿using AutoMapper;
using Sanelib.DataOperation;
using Sanelib.DataOperation.Impl;
using StructureMap.Configuration.DSL;

namespace WebApp.Initialization
{
    public class UiRegistry : Registry
    {
        public UiRegistry()
        {
            Scan(x =>
                {
                    x.TheCallingAssembly();
                    x.WithDefaultConventions();
                    x.AssemblyContainingType<IMappingEngine>();
                });

            For<IUnitOfWork>()
                .Singleton()
                .HybridHttpOrThreadLocalScoped()
                .Use<UnitOfWork>();

            For<IMappingEngine>().Use(ctx => Mapper.Engine);
        }
    }
}